; void productoEnCruz(float* a, float* b, unsined short n);

global productoEnCruz

%define a [ebp + 8]
%define b [ebp + 12]
%define n [ebp + 16]

section .text

productoEnCruz:
	push ebp
	mov ebp, esp
	push esi
	push edi
	push ebx
	
	xor ecx, ecx
	mov cx, n
	mov ebx, ecx
	sub ecx, 2
	
	mov edx, ecx
	
	mov esi, a
	mov edi, b
	
ciclo:
	movups xmm0, [esi + 4]
	movups xmm1, [esi + 4 * ebx]
	inc ebx
	movups xmm3, [esi + 8 * ebx]
	inc ebx
	movups xmm2, [esi + 4 * ebx]
	
	mulps xmm0, xmm3
	mulps xmm1, xmm2
	addps xmm0, xmm1
	
	movups [edi], xmm0
	
	add esi, 16
	add edi, 4
	sub edx, 4
	jnz ciclo
	
	add esi, 8
	
	mov edx, n
	sub edx 2
	loop ciclo
	
fin:
	pop ebx
	pop edi
	pop esi
	pop ebp
	ret
